import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

import menu from './module/menu'
import role from './module/role'
import admin from './module/admin'
import sort from  './module/sort'
import specs from  './module/specs'
import goods from  './module/goods'

const store = new Vuex.Store({
    state(){
        return {
            menuList: []
        }    
    },
    mutations:{
        //获取localstorage当中的数据
        menuListMutations(state){
            var data = JSON.parse(localStorage.getItem("userData"))
            state.menuList = data.menus
            console.log(data)
        }
    },
    actions:{
        //axios接口请求
    },
    getters:{

    },
    modules:{
        menu,
        role,
        admin,
        sort,
        specs,
        goods
    } //安装子模块
})

export default store